package com.freemalll.merchant.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.freemalll.merchant.domain.vo.merchantReport.MerchantBizPerfMonthVo;
import com.freemalll.merchant.domain.vo.merchantReport.MerchantBizPerfVo;
import com.freemalll.merchant.mapper.MerchantBusinessMapper;
import com.freemalll.merchant.service.MerchantBusinessService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author songshixiong
 * @ClassName MerchantBusinessServiceImpl
 * @description:
 * @date 2025年06月20日
 * @version: 1.0
 */
@Service
@DS("data_warehouse")
public class MerchantBusinessServiceImpl implements MerchantBusinessService {

    @Resource
    private MerchantBusinessMapper merchantBusinessMapper;

    @Override
    public List<MerchantBizPerfMonthVo> getBusinessPerformanceMonth(String merId, String tabType) {
        if ("liquidationDate".equals(tabType)) {
            //清算日统计
            return merchantBusinessMapper.getBusinessPerformanceMonthByLiquidationDate(merId);
        } else {
            //放款日统计
            return merchantBusinessMapper.getBusinessPerformanceMonthByLoanDisbursementDate(merId);
        }
    }

    @Override
    public MerchantBizPerfVo getBusinessPerformance(String merId) {
        return merchantBusinessMapper.getBusinessPerformance(merId);
    }
}
